package vn.edu.saigontech.ncms.util;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.FileInputStream;
import java.io.FileOutputStream;

public class IOUtil {

	public static void copy(String sourceFile, String destinationFile) {
		try {
			byte[] buffer = new byte[256];
			BufferedInputStream bis = new BufferedInputStream(new FileInputStream(sourceFile));
			BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(destinationFile));
			for (int bytesRead = bis.read(buffer); bytesRead != -1; bytesRead = bis.read(buffer)) {
				bos.write(buffer, 0, bytesRead);
			}
			bos.close();
			bis.close();
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
}